/**
 * @file Button.h
 * @see http://code.google.com/p/mega8-hob/source/browse/trunk/Button.h
 * @author Hamish Cumming & Brian Thorne
 * @version see SVN revision number
 */
#ifndef button_h
#define button_h
#include "colour.h"

/* Button Type  */
typedef struct
{
    char * label;
    int top;
    int left;
    int h;
    int w;
    int state;	// one of button_states enumeration values
    void(*action)(void);    //action is a pointer to a function that takes no args and returns nothing.
    colour_t colour_in;
    colour_t colour_out;
    colour_t colour_edge_in;
    colour_t colour_edge_out;
} button_t;

/* Constants */
enum button_states {BUT_OUT = 0, BUT_IN = 1, BUT_INVIS = 2};
/* The button centre is red when "out", blue when "in" */
/* The button edge is always black */
static colour_t button_edge_colour = black;
static colour_t button_out_colour = red;
static colour_t button_in_colour = blue;

/* Function Prototypes */
button_t make_button (int top, int left, int h, int w, char * label,void (*action)(void),colour_t c_in, colour_t c_out,colour_t c_edge_in, colour_t c_edge_out);
void change_button_state (button_t *button);
int get_button_state (button_t *button); 
void draw_button (button_t *button);
int mouse_in_button (int mouse_x, int mouse_y, button_t *button);

#endif
